<%@ page language="java" contentType="text/html; charset=UTF-8" import="ibm.websphere.monitor.util.UtilTool"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ include file="vars.jsp" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>生命粮后台管理系统</title>
    <link rel="stylesheet" type="text/css" href="${contextPath}/page/ext/resources/css/login.css"/>
</head>
<body>
<table width="681" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top: 120px">
    <tr>
        <td width="353" height="259" align="center" valign="bottom"  background="${contextPath}/page/common/images/login-sml.jpg">
            <table width="90%" border="0" cellspacing="3" cellpadding="0">
                <tr>
                    <td align="center" valign="bottom" style="color: #05B8E4">
                       		生命粮版权所有
                    </td>
                </tr>
            </table>
        </td>
        <td width="195" background="${contextPath}/page/common/images/login_2.gif">
            <form method="post" action="${contextPath}/LoginManage/login" name="NETSJ_Login">
                <s:hidden name="randomCode"/>
                <table width="190" height="106" border="0" align="center" cellpadding="2" cellspacing="0">
                    <tr>
                        <td height="50" colspan="2" align="left">&nbsp;</td>
                    </tr>
                    <tr>
                        <td width="60" height="30" align="left">
                           	 登陆名称
                        </td>
                        <td>
                           <s:textfield name="userName" id="userName" size="13" maxlength="20" cssStyle="width:120px; border: solid 1px #27B3FE; height: 20px; background-color: #FFFFFF" />
                        </td>
                    </tr>
                    <tr>
                        <td height="30" width="60" align="left">
                           	 登陆密码
                        </td>
                        <td>
                            <s:password name="passWord" id="passWord" size="13" maxlength="20" cssStyle="width:121px; border: solid 1px #27B3FE; height: 20px; background-color: #FFFFFF" />
                        </td>
                    </tr>
                    <tr>
                        <td height="30">
                          	  验 证 码
                        </td>
                        <td>
                            <s:textfield name="rand" id="rand" size="6" maxlength="4" cssStyle="width:50px; border: solid 1px #27B3FE; height: 20px; background-color: #FFFFFF" />
                            <img id="img_1" src="${contextPath}/page/pictures/<s:property value="randomCode" />.jpg" width="60" height="20"/>
                        </td>
                    </tr>
                    <tr>
                        <td height="40" colspan="2" align="center" >
                            <img src="${contextPath}/page/common/images/tip.gif" width="16" height="16" id="tipe" style="display: none">
                        	<span id='info' style="display: none">
                        			<%=UtilTool.getErrorCode(request.getParameter("errorCode"))==null ? UtilTool.getErrorCode("4") : UtilTool.getErrorCode(request.getParameter("errorCode"))%>

                        	</span>
                        </td>
                    <tr>
                        <td colspan="2" align="center">
                            <input type="submit" icon='icon-login' id="login_submit" name="submit"  style="background: url('${contextPath}/page/common/images/login_5.gif') no-repeat"   value=" 登  陆 ">
                            <input type="reset" icon='icon-login' name="Submit"  style="background: url('${contextPath}/page/common/images/login_5.gif') no-repeat" value=" 取  消 ">
                        </td>
                    <tr>
                        <td height="5" colspan="2"></td>
                </table>
            </form>
        </td>
        <td width="133" background="${contextPath}/page/common/images/login_3.gif">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td height="161" colspan="3" background="${contextPath}/page/common/images/login_4.gif"></td>
    </tr>
</table>
</body>
</html>
<script>
	 $(document).ready(function() {
 		if("${errorCode}"!=""){
 			$("#tipe").show();
 			$("#info").show();
 		}
	 	$("#login_submit").click(function() {
	 		if($("#userName").val()==""){
	 			 $("#tipe").show();
	 			 $("#info").show();
	 			 info.innerText ="登陆名称不能为空！";
	 			 return ;
	 		}
	 		if($("#passWord").val()==""){
	 			$("#tipe").show();
	 			$("#info").show();
	 			info.innerText ="登陆密码不能为空！";
	 			return ;
	 		}
	 		if($("#rand").val()==""){
	 			$("#tipe").show();
	 			$("#info").show();
	 			info.innerText ="随机码不能为空！";
	 			return ;
	 		}

	 		var targetForm = document.forms[0];
	        targetForm.submit();
	 	});

	 	$("body").bind('keyup',function(event) {
			if(event.keyCode==13){
				$("#login_submit").click();
			}
		});
	 });
</script>